#include<iostream>     //类似于#include<stdio.h>的作用  i - o - stream    输入输出流
#include<stdlib.h>
#include<stdio.h>
using namespace std;
#define num  6
#define casse1    ((0x80>>(num))&1)
#define casse2    ((0x80>>(num))&2)
#define casse3    ((0x80>>(num))&4)
#define casse4    ((0x80>>(num))&8)
#define casse5    ((0x80>>(num))&16)
#define casse6    ((0x80>>(num))&32)
#define casse7    ((0x80>>(num))&64)
//#pragma _C_Plus_Plus
//#extern "C"
//{
//#endif
#if casse1  
int main()
        {
               cout << "c++ program !\n"<< casse(num)  <<endl;     //cout :输出流对象 ; <<  插入运算符
               printf("the c++\n");
               system("pause");
               return 0;
        }
#endif

//    2
/*
//求两个值的和
#include <iostream>
#include<stdio.h>
#include<stdlib.h>
using namespace std;
int main()
{
        int a, b, sum;
        cin >> a >> b;    //scanf("%d,&d",&a,&b）;
        sum = a + b;
        cout << "a + b = " << sum <<endl;    //endl  ---->\n
        system("pause");
        return 0;
}
*/
//   3
/*
//求两个值最大值
#include<iostream>
#include<stdio.h>
#include<stdlib.h>
using namespace std;
int _max_value(int a, int b)
{
        return a > b ? a : b;
}
int main(void)
{
        int max;
        int a, b;
        cin >> a >> b;
        max = _max_value(a, b);
        cout << "max = " << max << endl;
        system("pause");
        return 0;
}
*/
//      4   类的使用
/*
#include<iostream>
#include<stdio.h>
#include <stdlib.h>
using namespace std;
class st         //定义类，类的类型有三种，公有 私有 派生
{
private:              //私有类，只能在类的内部使用
        int num;
        int score;
public:               //公有类，可以被外部使用
        void setdata()    //类里面的函数可以当变量用
        {
               cin >> num;
               cin >> score;
        }
        void display()
        {
               cout << "num =" << num << endl;
               cout << "score =" << score << endl;
        }
};
int main(void)
{
        st str1, str2;
        str1.setdata();
        str2.setdata();
        str1.display();
        str2.display();
        system("pause");
        return 0;
}
*/
//       5
/*
#include<iostream>
#include<stdio.h>
#include<stdlib.h>
using namespace std;
int main(void)
{
        int i = 2;
        cout << "sum =" << endl;
        system("pause");
        return 0;
}
*/
//     6, 不同类型一起输入，但是输出类型不能改变（输入是什么，输出是什么）
/*
#include<iostream>
#include<stdio.h>
#include<stdlib.h>
using namespace std;
int main(void)
{
        char table[10];   
        int age;
        char ageage = 0;
        cin >> table >> age;
        ageage = (char)age;        //不支持类型转换
        cout << "name = " << table << endl << "age = " << age << endl<<"ageage =  "<<ageage<<endl;
        system("pause");
        return 0;
}
*/
//   7   函数的重载,两个函数上函数名相同，但所带参数类型或者个数不同，就可以重名
/*
#include<iostream>
#include<stdio.h>
#include<stdlib.h>
using namespace std;
int max(int a, int b,int c)
{
        return (a > b ? a : b)>c ? (a > b ? a : b) : c;
}
int max(int a, int b)
{
        return a > b ? a : b;
}
int max(float a,float b)
{
        return (int)(a > b ? a : b);
}
char max(char a,char b)
{
        return a > b ? a : b;
}
int main(void)
{
        int a, b,q,isum2,isum3;
        float c, d,fsum;
        char A, B,csum;
        cin >> a >> b >> q >> c >> d >> A >> B;
        isum3 = max(a, b,q);
        isum2 = max(a, b);
        fsum = (float)max(c, d);
        csum = max(A, B);
        cout << "int sum = " << isum3 <<"   " <<  isum2  << endl << "float sum = " << fsum  << endl << "char sum = " << csum << endl;
        system("pause");
        return 0;
}
*/
/*         8
//函数模板   有点类似于隐含类型转换
#include <iostream>
#include<stdlib.h>
using namespace std;
template <typename SUN>
SUN max(SUN a, SUN b)
{
        return a > b ? a : b;
}
int main(void)
{
        int ia,ib,imax;
        float fa, fb, fmax;
        cin >> ia >> ib >> fa >> fb;
        imax = max(ia, ib);
        fmax = max(fa, fb);
        cout << imax << endl << fmax << endl;
        system("pause");
        return 0;
}
*/
/*           9
//变量的引用最大的作用就是在形参上
//变量的引用最大的作用就是在形参上
//变量的引用  ，引用的变量类型要一样，引用就是取别名，a和b的地址实际上是同一个，引用就是取别名，引用就是取别名，引用就是取别名
//对同一个地址区两个名字，
#include<iostream>
#include<stdlib.h>
#include<stdio.h>
using namespace std;
int main(void)
{
        int a = 10;
        int &b = a;
        a = 20;
        cout << a << endl << b << endl;
               a = 40;
               cout << "a = " << a << endl << "b = " << b << endl;
               system("pause");
               return 0;
}
*/
/*            10
//C语言中值传递的方式
#include<iostream>
#include<stdlib.h>
#include<stdio.h>
using namespace std;
int swap(int *a, int *b)
{
        int temp;
        temp = *a;
        *a = *b;
        *b = temp;
        return 0;
}
int main(void)
{
        int a = 10,b = 20;
        swap(&a, &b);    //a , b 的值通过指针间接互换
        cout << "a = " << a << endl << "b = " << b << endl;
        system("pause");
        return 0;
}
*/
//C++中利用引用实现值的传递，实现和指针一样的操作,形参中利用引用的方式，引用的变量就是完全等于传递的值
/*                11
#include<iostream>
#include<stdio.h>
#include<stdlib.h>
using namespace std;
int swap(int &a, int &b)
{
        int temp;
        temp = a;
        a = b;
        b = temp;
        return 0;
}
int main(void)
{
        int a = 10, b = 20;
        swap(a, b);    //a , b 的值通过指针间接互换
        cout << "a = " << a << endl << "b = " << b << endl;
        system("pause");
        return 0;
}
*/
/**
                  12
#define _CRT_SECURE_NO_WARNINGS
//内置函数  inline
#include<iostream>
#include<stdio.h>
#include<stdlib.h>
using namespace std;
inline int max(int &a, int &b)
{
        return a > b ? a : b;
}
int main(void)
{
        int a, b, m;
//      scanf(" a = %d", &b);    //cin  >> "b = " >> b; 是错的  
        cin  >> a >> b;          //输入只能输入变量，不能直接输入字符串
        m = max(a,b);
        cout<< "a = "<<a << "b = " << b<<"max = "<<m<< endl;
        system("pause");
        return 0;
}
*/
/*               13
//作用域 ::        string 字符串型变量
#include<iostream>
#include<stdlib.h>
#include<stdio.h>
using namespace std;
int a = 10;
int main(void)
{
        string str[10] = { "china of woeld,whis dd" };
        string str1 = "afdgfdassad";
        str[1] = str1;
        int a = 23;
        cout << "string 的大小" << sizeof(str) << endl ;
        cout << ::a<< endl;     //作用域
        system("pause");
        return 0;
}
*/
/*    
//14
#define  _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<stdio.h>
#include<stdlib.h>
#include<string>
using namespace std;
int main(void)
{
        string str1 = "abcd", str2 = "ABCD", str3 = "qwer", temp;
//      cin >> str1 >> str2 >> str3;
        temp = str1 + str2;
        str1 = str2 + str3;
        cout << "string 的大小" << sizeof(string) << endl;
        cout << temp << "  " << str1 << endl;
        system("pause");
        return 0;
}
*/
  //                  15
//动态开辟内存和释放内存
//new  和delete是运算符，不是函数
//new int;  new char[2][];
//new float(3014159)
//int *p = new int ;   
//不管是C还是C++，动态开辟的内存都是用指针进行访问的，不能对开辟的内存取别名
/*
#define  _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
using namespace std;
typedef struct sta
{
        char a[10];
        int b;
        char c;
}st;
int main(void)
{
        st *p = new st;      //开辟一块空间，是st类型的  ，并用结构体指针指向它，获取内存地址   // st *p = (st *)malloc(sizeof(st));
        strcpy(p->a, "xiao ming");
        p->b = 1001;
        p->c = 'S';
        cout << p->a << "  " << p->b << "   " << p->c << endl;
        delete p;  //释放开辟的地址，delete后必须是要释放的那块内存的地址
        system("pause");
        return 0;
}
*/



//-------------------------------------------------------------------
#include<iostream>
#include<stdio.h>
#include<stdlib.h>
#include<string>
using namespace std;
int f(int a, int b, int c)
{
        int m;
        if (a > b)
               m = b;
        else
               m = a;
        if (c < m)
               m = c;
        return m;
}
/*
//  ti mu 3
int main(void)
{
int a, b, c;
cin >> a >> b >> c;
c = f(a, b, c);
cout << c << endl;
system("pause");
return 0;
}
*/
/**
//     xi ti 4
int main(void)
{
int a = 3, b = 5, c;
c = a + b;
cout << "a + b = " << a + b << endl;
system("pause");
return 0;
}
*/
/*
//           xi ti  7
int max(int a = 8, int b = 10)
{
return a > b ? a : b ;
}
int main(void)
{
int a;
cin >> a;
int z;
z = max();    // z = max(a);   ye ke yi
cout << "max = " << z << endl;
system("pause");
return 0;
}
*/
/*
//        xi ti  8
int paixu(int &a, int &b)
{
int temp;
if (a > b)
{
return 0;
}
else
{
temp = a;
a = b;
b = temp;
return 0;
}
}
int main(void)
{
int a, b;
cin >> a>> b ;
paixu(a, b);
cout << a << ">"<< b << endl;
system("pause");
return 0;
}
*/
/*
//   xi ti 9
int paixu(int &a, int &b, int &c)
{
int temp;
for (int i = 0; i < 2; i++)
{
if (c > b)
{
temp = c;
c = b;
b = temp;
}
if (a < b)
{
temp = b;
b = a;
a = temp;
}
}
return 0;
}
int main(void)
{
int x, y, z;
cin >> x >> y>> z;
paixu(x, y, z);
cout << x << ">" << y << ">" << z << endl;
system("pause");
return 0;
}
*/
/*
int main(void)
{
string str1 = "qzbfefgefdge", str2 = "qzcd", str3;
str3 = str1 + str2;
if(str2 > str1)          //字符串大小比较是从左到右一个字符一个字符的比较，当有不同的字符时，哪个字符大，就输出对应的字符串
cout << str2 << endl;
else
cout << str1 << endl;
system("pause");
return 0;
}
*/
/*
int main(void)
{
    string str1;
    cin >> str1;
//获得反向枚举器，反向遍历
    string::reverse_iterator iter = str1.rbegin();
    cout << "输出字符串 : ";
    while (iter != str1.rend())
        {
               cout << *iter;
               iter++;
        }
        getchar();
        system("pause");
        return 0;
}
*/
/*
//对N个数进行排序，冒泡排序
template <typename SUN>            //函数的重载方式
#define jz_type float
SUN paixu(SUN *p, int num)
{
    int i, j;
    jz_type temp = 0;
    cout << endl;
    for (i = 0; i <= num; i++)
    {
               for (j = i+1; j < num ; j++)
               {
                       if (p[i] > p[j])
                       {
                              temp = p[i];
                              p[i] = p[j];
                              p[j] = temp;
                       }
               }
        }
        for (i = 0; i < num; i++)
        {
               cout << p[i] << "   ";
        }
return 0;
}
//               14函数模板实现排列
int main(void)
{
        int num;
        jz_type sum;
        cout << "请输入数据个数  : ";
        cin >> num;
        jz_type table[30] = { 0 };                     //数组做地址传递的时候必须指定内存大小
        cout << endl << "shuru yuanshu";
        for( int i = 0;i<num;i++)
               cin >> table[i];
        sum = paixu(table, num);
        system("pause");
        return 0;
}
*/